//
//  CategoryCollectionCell.m
//  礼物
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 liangsicheng. All rights reserved.
//

#import "CategoryCollectionCell.h"

@implementation CategoryCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSub];
    }
    return self;
}
-(void)createSub
{
    self.photoImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80*WSCALE, 80*WSCALE)];
    [self.contentView addSubview:self.photoImage];
//    self.backgroundColor = [UIColor lightGrayColor];
    
    self.titleLable = [[BaseLabel alloc] initWithFrame:CGRectMake(0, self.photoImage.frame.size.height, 80*WSCALE, 25*HSCALE)];
    [self.contentView addSubview:self.titleLable];
    self.titleLable.font = [UIFont systemFontOfSize:15*HSCALE];
    self.titleLable.textAlignment = NSTextAlignmentCenter;
//    self.titleLable.backgroundColor = [UIColor blueColor];
}
-(void)setCategory:(CategoryModel *)category
{
    _category = category;
    [self.photoImage sd_setImageWithURL:[NSURL URLWithString:category.icon_url]];
    NSLog(@"category.name = %@, category.icon_url = %@",category.name,category.icon_url);
    self.titleLable.text = category.name;
}
@end
